<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2022/4/28
  Time: 19:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>简易计算器接收</title>
</head>
<body>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>简易计算器</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
%>
<%=request.getParameter("num1")%>


<%
    if(request.getParameter("countMethod")!=null){
        String s=request.getParameter("countMethod");
        out.println(s);
    }
%>
<%=request.getParameter("num2")%>

<%
    String result;
    String num1=request.getParameter("num1");
    String num2=request.getParameter("num2");
    String s=request.getParameter("countMethod");
    if(num2.equals("0")){
        result = "除数不能为0";
        out.println("="+result);
    }
    else if(s.equals("+")){
        result = String.valueOf(Integer.valueOf(num1) + Integer.valueOf(num2) );
        out.println("="+result);
    }
    else if(s.equals("-")){
        result = String.valueOf(Integer.valueOf(num1) - Integer.valueOf(num2) );
        out.println("="+result);
    }
    else if(s.equals("*")){
        result = String.valueOf(Integer.valueOf(num1) * Integer.valueOf(num2) );
        out.println("="+result);
    }
    else if(s.equals("/")){
        result = String.valueOf(Integer.valueOf(num1) / Integer.valueOf(num2) );
        out.println("="+result);
    }

%>


</body>
</html>
</body>
</html>
